The arithmetic coding is known as an efficient data compressing method and is widely used in coding standards, such as JBIG, JPEG2000, H.264/AVC, and High-Efficiency Video Coding (HEVC). In H.264/AVC JVT Test Model (JM) and HEVC Test Model (HM), Context-Based Adaptive Binary Arithmetic Coding (CABAC) is adopted as the entropy coding tool for various syntax elements in the video coding system.
FIG. 1 illustrates an example of CABAC encoder 100 which includes three parts: Binarization 110, Context Modeling 120, and Binary Arithmetic Coding (BAC) 130. In the binarization step, each syntax element is uniquely mapped into a binary string (also called bin or bins in this disclosure). In the context modeling step, a probability model is selected for each bin. The corresponding probability model may depend on previously encoded syntax elements, bin indices, side information, or any combination of the above. After the binarization and the context model assignment, a bin value along with its associated context model is provided to the binary arithmetic coding engine, i.e., the BAC 130 block in FIG. 1. The bin value can be coded in two coding modes depending on the syntax element and bin indices, where one is the regular coding mode, and the other is the bypass mode. The bins corresponding to regular coding mode are referred to as regular bins and the bins corresponding to bypass coding mode are referred to as bypass bins in this disclosure. In the regular coding mode, the probability of the Most Probable Symbol (MPS) and the probability of the Least Probable Symbol (LPS) for BAC are derived from the associated context model. In the bypass coding mode, the probability of the MPS and the LPS are equal. In CABAC, the bypass mode is introduced to speed up the encoding process.
In HEVC Test Model Version 5.0 (HM-5.0), syntax elements such as merge_flag (related to the merge flag for a coding unit, i.e., CU), merge_idx (related to the merge index), ref_idx_1c/ref_idx_10/ref_idx/11 (related to the reference picture index), pred_type (related to the prediction type), and cu_qp_delta (related to delta of quantization parameter QP for a CU) are coded using CABAC. Syntax element merge_flag, which has a value equal to either 0 or 1, has only one bin and is coded using one context. The bin strings of merge_idx, ref_idx_1c/ref_idx 10/ref_idx/11, and pred_type are shown in Table 1, Table 2 and Table 3 respectively. For merge_idx, pred_type and ref_idx_1c/ref_idx_10/ref_idx/11, one context is used for each bin. For ref_idx_1c/ref_idx 10/ref_idx 11, if the maximum value of ref_idx_1c/ref_idx_10/ref_idx/11 is larger than 3, the additional bins share the same context as the bin with binIdx equal to 2. For cu_qp_delta, the bin string is specified by a process equivalent to the following pseudo-code. The value of cu_qp_delta is denoted as synVal. For bin 0 (i.e., binIdx=0), the bin value is associated with the condition regarding whether abs(synVal) is equal to 0 or greater than 0 as shown in the pseudo code. When bin 0 has a value of 1, one or more additional bins are used to represent the value of delta QP. In the pseudo code, parameter QpBdOffsetY is recited due to specific data representation of delta QP used in HM-5.0 and QpBdOffsetY is related to bit depth of underlying video data.
TABLE 1Bin string of merge_idx in HM5.0ValueBin string0011021103111041111binIdx0123
TABLE 2Bin string of ref_idx_lc/ref_idx_l0/ref_idx_l1 in HM5.0ValueBin string00110211031110. . .. . .. . .. . .. . .. . .N − 1111110N1111. . .11binIdx0123. . .N − 2N − 1
TABLE 3Bin string of pred_type for inter blocks in HM5.0Bin stringcLog2CUSize = = Log2MinCUSizeSliceValue ofcLog2CUSize >cLog2CUSize = = 3 &&cLog2CUSize > 3 | |typepred_typePredModePartModeLog2MinCUSize!inter_4x4_enabled_flaginter_4x4_enabled_flagI0MODE_INTRAPART_2Nx2N—111MODE_INTRAPART_NxN—00P/B0MODE_INTERPART_2Nx2N0101011MODE_INTERPART_2NxN00110010012MODE_INTERPART_Nx2N000100000014MODE_INTERPART_2NxnU00100——5MODE_INTERPART_2NxnD00101——6MODE_INTERPART_nLx2N00000——7MODE_INTERPART_nRx2N00001——3MODE_INTERPART_NxN——00004MODE_INTRAPART_2Nx2N111115MODE_INTRAPART_NxN—1010binIdx012340120123
Pseudo Code for Bin String Generation of Cu_Qp_Delta:
absV = abs( synVal )if( absV = = 0 ){put( 0 ) ---------------------------------------------------binIdx = 0} else {put( 1 ) ---------------------------------------------------binIdx = 0signV = ( synVal > 0 ) ? 0 : 1put( signV )cMax = 24 + ( QpBdOffsetY >> 1 ) + signVcNum = absV − 1absVGreaterThan1Flag = ( absV = = 1 ) ? 0 : 1put( absVGreaterThan1Flag ) ---------------------------binIdx = 1if( absVGreaterThan1Flag ){while( cNum−− )put( 1 ) ------------------------------------binIdx = 2......if( cMax > absV − 1 )put( 0 )}}
The contexts used for the bin string are also indicated in the above pseudo code. The first two bins of cu_qp_delta (i.e., binIdx=0 and 1) use two separate contexts for each bin, while other bins (i.e., binIdx≥2) share one common context. When a bin is coded using contexts, it requires additional memory and also results in higher complexity at both encoder and decoder sides. Therefore, it is desirable to reduce the number of contexts required.